package de.homelabs.bookstore.controller;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import de.homelabs.bookstore.service.IBuchService;

@Controller
public class UebersichtController {

	@Autowired
	IBuchService buchService;
	
	@RequestMapping(value="/uebersicht.htm", method=RequestMethod.GET)
	public ModelAndView handleUebersicht(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		//vars
		Map<String, Object> model = new HashMap<String, Object>();
		
		//fulle model
		model.put("buecher", buchService.holeAlleBuecher());
		model.put("test", "fdshgkjfdhg");
		
		//return view
		return new ModelAndView("uebersicht", model);
	}
}
